package com.face.service;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.face.util.FileUtil;

@Service
public class FileUploadService {

    @Value("${image.path}")
    private String imagePath;

    public String uploadImage(byte[] file){
        if(file == null){
            return null;
        }
        String fileName = UUID.randomUUID().toString().replaceAll("-","") + ".png";
        FileUtil.save(imagePath,fileName,file);
        return imagePath + fileName;
    }
}
